//通用数据
export interface IAdminUser {
  id: number;
  username: string;
  type: string;//system,website
  website_id: number;
}
export interface IConversation {
  id: number;
  relation_id: number;
  website_id: number;
  customer_id: number;
  service_id: number;
  message: string;
  message_round: string;//s2c客服发送给用户, c2s用户发给客服
  create_time: string;
  sender: ISender
  type:string;//file text
}

export interface IWebsite {
  id: number;
  name: string;
  address_url: string;
  icon_url: string;
  create_time: string;
}

export interface IConversationRelation {
  id: number;
  customer_id: number;
  customer_status: string;//on,off
  service_id: number;
  service_status: string;//on,off
  score: number;
  insert_time: string;
  update_time: string;
  customer: ICustomer;
  service: IWebsiteService;
  conversations: Record<string,IConversation>;
  auto_replay: boolean;
  status:number; //0为解决，1已解决
  hasNew: boolean; //是否有新消息，当重置currentConversationId时，标记为false
}

export interface IWebsiteService {
  id: number;
  website_id: number;
  username: string;
  account: string;
  head_url: string;
  ai_open: number;//1开启，0关闭
  is_delete: number; //not use
  is_default: number; //not use
  create_time: string;
  update_time: string;
}

export interface ICustomer {
  id: number;
  customer_session: string; //用户三方id，可能是session
  website_id: number;
  current_service_id: number;
  create_time: string;
}

//面板权限控制
export interface ISettings {
  darkMode: boolean;
  showAiSetting: boolean; //ai控制面板
  showWebSiteConfigSetting: boolean; //网站管理面板，在设置中
  showPeopleSetting: boolean; //人员管理面板
}

export interface ISender {
  id: number,
  head_url: string,
  name: string
}

//定义网络接口的数据格式
export interface IWebsiteBaseInfo {
  conversations: Record<string,IConversation>,
  customer:ICustomer,
  services:Record<string,IWebsiteService>,
  website:IWebsite,
}

export interface IServiceLogin {
  conversationRelations: Record<string,IConversationRelation>,
  customers:Record<string,ICustomer>,
  services:Record<string,IWebsiteService>,
  service:IWebsiteService
  website:IWebsite,
}

export interface IFileUpLoad {
  file:any
}

export interface IGetHistory {
  conversations:Record<string,IConversation>
}

export interface IGetConversationRelationHistory {
  relations:Record<string,IConversationRelation>
}